package com.hippoframework.bean;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;

import lombok.Data;

/**
 * 依赖注入属性描述
 *
 * @author TylerW
 * @date 1/22/2020 3:11 PM
 */
@Data
public class DependencyDescriptor {

    /**
     * 是否必要依赖
     */
    private final boolean required;

    /**
     * 成员属性
     */
    private final Field field;

    /**
     * 属性名称 - 来自field
     */
    private final String fieldName;

    /**
     * 属性拥有者
     */
    private final Class<?> declaringClass;

    /**
     * 属性注解
     */
    private Annotation[] fieldAnnotations;

    public DependencyDescriptor(Field field, boolean required, Class<?> declaringClass) {
        this.field = field;
        this.required = required;
        this.declaringClass = declaringClass;
        fieldName = field.getName();
        fieldAnnotations = field.getAnnotations();
    }

}
